
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="robots" content="index,follow" />
    <meta name="creator" content="rfchandler version 0.2" />
      <meta name="citation_author" content="J. Reschke"/>
      <meta name="citation_publication_date" content="August, 2010"/>
      <meta name="citation_title" content="Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters"/>
      <meta name="citation_doi" content="10.17487/RFC5987"/>
      <meta name="citation_issn" content="2070-1721"/>
      <meta name="citation_technical_report_number" content="rfc5987">
      <meta name="citation_pdf_url" content="https://www.rfc-editor.org/rfc/pdfrfc/rfc5987.txt.pdf"/>
<title>RFC 5987: Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters</title>    
        

        <style type="text/css">
	@media only screen 
	  and (min-width: 992px)
	  and (max-width: 1199px) {
	    body { font-size: 14pt; }
            div.content { width: 96ex; margin: 0 auto; }
        }
	@media only screen 
	  and (min-width: 768px)
	  and (max-width: 991px) {
            body { font-size: 14pt; }
            div.content { width: 96ex; margin: 0 auto; }
        }
	@media only screen 
	  and (min-width: 480px)
	  and (max-width: 767px) {
            body { font-size: 11pt; }
            div.content { width: 96ex; margin: 0 auto; }
        }
	@media only screen 
	  and (max-width: 479px) {
            body { font-size: 8pt; }
            div.content { width: 96ex; margin: 0 auto; }
        }
	@media only screen 
	  and (min-device-width : 375px) 
	  and (max-device-width : 667px) {
            body { font-size: 9.5pt; }
            div.content { width: 96ex; margin: 0; }
        }
	@media only screen 
	  and (min-device-width: 1200px) {
            body { font-size: 10pt; margin: 0 4em; }
            div.content { width: 96ex; margin: 0; }
        }
        h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
	    font-weight: bold;
            line-height: 0pt;
            display: inline;
            white-space: pre;
            font-family: monospace;
            font-size: 1em;
	    font-weight: bold;
        }
        pre {
            font-size: 1em;
            margin-top: 0px;
            margin-bottom: 0px;
        }
	.pre {
	    white-space: pre;
	    font-family: monospace;
	}
	.header{
	    font-weight: bold;
	}
        .newpage {
            page-break-before: always;
        }
        .invisible {
            text-decoration: none;
            color: white;
        }
        a.selflink {
          color: black;
          text-decoration: none;
        }
        @media print {
            body {
                font-family: monospace;
                font-size: 10.5pt;
            }
            h1, h2, h3, h4, h5, h6 {
                font-size: 1em;
            }
        
            a:link, a:visited {
                color: inherit;
                text-decoration: none;
            }
            .noprint {
                display: none;
            }
        }
	@media screen {
	    .grey, .grey a:link, .grey a:visited {
		color: #777;
	    }
            .docinfo {
                background-color: #EEE;
            }
            .top {
                border-top: 7px solid #EEE;
            }
            .bgwhite  { background-color: white; }
            .bgred    { background-color: #F44; }
            .bggrey   { background-color: #666; }
            .bgbrown  { background-color: #840; }            
            .bgorange { background-color: #FA0; }
            .bgyellow { background-color: #EE0; }
            .bgmagenta{ background-color: #F4F; }
            .bgblue   { background-color: #66F; }
            .bgcyan   { background-color: #4DD; }
            .bggreen  { background-color: #4F4; }

            .legend   { font-size: 90%; }
            .cplate   { font-size: 70%; border: solid grey 1px; }
	}
    </style>
    <!--[if IE]>
    <style>
    body {
       font-size: 13px;
       margin: 10px 10px;
    }
    </style>
    <![endif]-->    <script type="text/javascript"><!--
    function addHeaderTags() {
        var spans = document.getElementsByTagName("span");
        for (var i=0; i < spans.length; i++) {
            var elem = spans[i];
            if (elem) {
                var level = elem.getAttribute("class");
                if (level == "h1" || level == "h2" || level == "h3" || level == "h4" || level == "h5" || level == "h6") {
                    elem.innerHTML = "<"+level+">"+elem.innerHTML+"</"+level+">";               
                }
            }
        }
    }
    var legend_html = "Colour legend:<br />      <table>         <tr><td>Unknown:</td>                   <td><span class='cplate bgwhite'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Draft:</td>                     <td><span class='cplate bgred'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Informational:</td>             <td><span class='cplate bgorange'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Experimental:</td>              <td><span class='cplate bgyellow'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Best Common Practice:</td>      <td><span class='cplate bgmagenta'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Proposed Standard:</td>         <td><span class='cplate bgblue'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Draft Standard (old designation):</td> <td><span class='cplate bgcyan'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Internet Standard:</td>         <td><span class='cplate bggreen'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Historic:</td>                  <td><span class='cplate bggrey'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>         <tr><td>Obsolete:</td>                  <td><span class='cplate bgbrown'>&nbsp;&nbsp;&nbsp;&nbsp;</span></td></tr>     </table>";
    function showElem(id) {
        var elem = document.getElementById(id);
        elem.innerHTML = eval(id+"_html");
        elem.style.visibility='visible';
    }
    function hideElem(id) {
        var elem = document.getElementById(id);
        elem.style.visibility='hidden';        
        elem.innerHTML = "";
    }
    // -->
    </script></head>
<body>
<span class="pre noprint docinfo">[<a href="https://www.rfc-editor.org" title="RFC Editor">RFC Home</a>] [<a href="/rfc/rfc5987.txt">TEXT</a>|<a href="/rfc/pdfrfc/rfc5987.txt.pdf">PDF</a>|<a href="/rfc/rfc5987.html">HTML</a>] [<a href='https://datatracker.ietf.org/doc/rfc5987' title='IETF Datatracker information for this document'>Tracker</a>] [<a href="https://datatracker.ietf.org/ipr/search/?rfc=5987&amp;submit=rfc" title="IPR disclosures related to this document">IPR</a>] [<a href='https://www.rfc-editor.org/info/rfc5987' title='Info page'>Info page</a>]                  </span><br/><span class="pre noprint docinfo">                                                                        </span><br /><span class="pre noprint docinfo">Obsoleted by: <a href="/rfc/rfc8187" target="_blank">8187</a>                                              HISTORIC</span><br /><span class="pre noprint docinfo">                                                                        </span><pre>Internet Engineering Task Force (IETF)                        J. Reschke
Request for Comments: 5987                                    greenbytes
Category: Standards Track                                    August 2010
ISSN: 2070-1721


                <span class="h1">Character Set and Language Encoding for</span>
       <span class="h1">Hypertext Transfer Protocol (HTTP) Header Field Parameters</span>

Abstract

   By default, message header field parameters in Hypertext Transfer
   Protocol (HTTP) messages cannot carry characters outside the ISO-
   8859-1 character set.  <a href="./rfc2231">RFC 2231</a> defines an encoding mechanism for use
   in Multipurpose Internet Mail Extensions (MIME) headers.  This
   document specifies an encoding suitable for use in HTTP header fields
   that is compatible with a profile of the encoding defined in <a href="./rfc2231">RFC</a>
   <a href="./rfc2231">2231</a>.

Status of This Memo

   This is an Internet Standards Track document.

   This document is a product of the Internet Engineering Task Force
   (IETF).  It represents the consensus of the IETF community.  It has
   received public review and has been approved for publication by the
   Internet Engineering Steering Group (IESG).  Further information on
   Internet Standards is available in <a href="./rfc5741#section-2">Section&nbsp;2 of RFC 5741</a>.

   Information about the current status of this document, any errata,
   and how to provide feedback on it may be obtained at
   <a href="http://www.rfc-editor.org/info/rfc5987">http://www.rfc-editor.org/info/rfc5987</a>.

Copyright Notice

   Copyright (c) 2010 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.




<span class="grey">Reschke                      Standards Track                    [Page 1]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-2" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


Table of Contents

   <a href="#section-1">1</a>. Introduction ....................................................<a href="#page-2">2</a>
   <a href="#section-2">2</a>. Notational Conventions ..........................................<a href="#page-2">2</a>
   <a href="#section-3">3</a>. Comparison to <a href="./rfc2231">RFC 2231</a> and Definition of the Encoding ...........<a href="#page-3">3</a>
      <a href="#section-3.1">3.1</a>. Parameter Continuations ....................................<a href="#page-3">3</a>
      <a href="#section-3.2">3.2</a>. Parameter Value Character Set and Language Information .....<a href="#page-3">3</a>
           <a href="#section-3.2.1">3.2.1</a>. Definition ..........................................<a href="#page-3">3</a>
           <a href="#section-3.2.2">3.2.2</a>. Examples ............................................<a href="#page-6">6</a>
      <a href="#section-3.3">3.3</a>. Language Specification in Encoded Words ....................<a href="#page-6">6</a>
   <a href="#section-4">4</a>. Guidelines for Usage in HTTP Header Field Definitions ...........<a href="#page-7">7</a>
      <a href="#section-4.1">4.1</a>. When to Use the Extension ..................................<a href="#page-7">7</a>
      <a href="#section-4.2">4.2</a>. Error Handling .............................................<a href="#page-7">7</a>
   <a href="#section-5">5</a>. Security Considerations .........................................<a href="#page-8">8</a>
   <a href="#section-6">6</a>. Acknowledgements ................................................<a href="#page-8">8</a>
   <a href="#section-7">7</a>. References ......................................................<a href="#page-8">8</a>
      <a href="#section-7.1">7.1</a>. Normative References .......................................<a href="#page-8">8</a>
      <a href="#section-7.2">7.2</a>. Informative References .....................................<a href="#page-9">9</a>

<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>.  Introduction</span>

   By default, message header field parameters in HTTP ([<a href="./rfc2616" title="&quot;Hypertext Transfer Protocol -- HTTP/1.1&quot;">RFC2616</a>])
   messages cannot carry characters outside the ISO-8859-1 character set
   ([<a href="#ref-ISO-8859-1" title="&quot;Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1&quot;">ISO-8859-1</a>]).  <a href="./rfc2231">RFC 2231</a> ([<a href="./rfc2231" title="&quot;MIME Parameter Value and Encoded Word Extensions: Character Sets, Languages, and Continuations&quot;">RFC2231</a>]) defines an encoding mechanism
   for use in MIME headers.  This document specifies an encoding
   suitable for use in HTTP header fields that is compatible with a
   profile of the encoding defined in <a href="./rfc2231">RFC 2231</a>.

      Note: in the remainder of this document, <a href="./rfc2231">RFC 2231</a> is only
      referenced for the purpose of explaining the choice of features
      that were adopted; they are therefore purely informative.

      Note: this encoding does not apply to message payloads transmitted
      over HTTP, such as when using the media type "multipart/form-data"
      ([<a href="./rfc2388" title="&quot;Returning Values from Forms: multipart/ form-data&quot;">RFC2388</a>]).

<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>.  Notational Conventions</span>

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
   document are to be interpreted as described in [<a href="./rfc2119" title="&quot;Key words for use in RFCs to Indicate Requirement Levels&quot;">RFC2119</a>].

   This specification uses the ABNF (Augmented Backus-Naur Form)
   notation defined in [<a href="./rfc5234" title="&quot;Augmented BNF for Syntax Specifications: ABNF&quot;">RFC5234</a>].  The following core rules are included
   by reference, as defined in <a href="./rfc5234#appendix-B.1">[RFC5234], Appendix&nbsp;B.1</a>: ALPHA (letters),
   DIGIT (decimal 0-9), HEXDIG (hexadecimal 0-9/A-F/a-f), and LWSP
   (linear whitespace).




<span class="grey">Reschke                      Standards Track                    [Page 2]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-3" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


   Note that this specification uses the term "character set" for
   consistency with other IETF specifications such as <a href="./rfc2277">RFC 2277</a> (see
   <a href="./rfc2277#section-3">[RFC2277], Section&nbsp;3</a>).  A more accurate term would be "character
   encoding" (a mapping of code points to octet sequences).

<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>.  Comparison to <a href="./rfc2231">RFC 2231</a> and Definition of the Encoding</span>

   <a href="./rfc2231">RFC 2231</a> defines several extensions to MIME.  The sections below
   discuss if and how they apply to HTTP header fields.

   In short:

   o  Parameter Continuations aren't needed (<a href="#section-3.1">Section 3.1</a>),

   o  Character Set and Language Information are useful, therefore a
      simple subset is specified (<a href="#section-3.2">Section 3.2</a>), and

   o  Language Specifications in Encoded Words aren't needed
      (<a href="#section-3.3">Section 3.3</a>).

<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>.  Parameter Continuations</span>

   <a href="./rfc2231#section-3">Section&nbsp;3 of [RFC2231]</a> defines a mechanism that deals with the length
   limitations that apply to MIME headers.  These limitations do not
   apply to HTTP (<a href="./rfc2616#section-19.4.7">[RFC2616], Section&nbsp;19.4.7</a>).

   Thus, parameter continuations are not part of the encoding defined by
   this specification.

<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>.  Parameter Value Character Set and Language Information</span>

   <a href="./rfc2231#section-4">Section&nbsp;4 of [RFC2231]</a> specifies how to embed language information
   into parameter values, and also how to encode non-ASCII characters,
   dealing with restrictions both in MIME and HTTP header parameters.

   However, <a href="./rfc2231">RFC 2231</a> does not specify a mandatory-to-implement character
   set, making it hard for senders to decide which character set to use.
   Thus, recipients implementing this specification MUST support the
   character sets "ISO-8859-1" [<a href="#ref-ISO-8859-1" title="&quot;Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1&quot;">ISO-8859-1</a>] and "UTF-8" [<a href="./rfc3629" title="&quot;UTF-8, a transformation format of ISO 10646&quot;">RFC3629</a>].

   Furthermore, <a href="./rfc2231">RFC 2231</a> allows the character set information to be left
   out.  The encoding defined by this specification does not allow that.

<span class="h4"><a class="selflink" id="section-3.2.1" href="#section-3.2.1">3.2.1</a>.  Definition</span>

   The syntax for parameters is defined in <a href="./rfc2616#section-3.6">Section&nbsp;3.6 of [RFC2616]</a>
   (with <a href="./rfc2616">RFC 2616</a> implied LWS translated to <a href="./rfc5234">RFC 5234</a> LWSP):




<span class="grey">Reschke                      Standards Track                    [Page 3]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-4" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


     parameter     = attribute LWSP "=" LWSP value

     attribute     = token
     value         = token / quoted-string

     quoted-string = &lt;quoted-string, defined in <a href="./rfc2616#section-2.2">[RFC2616], Section&nbsp;2.2</a>&gt;
     token         = &lt;token, defined in <a href="./rfc2616#section-2.2">[RFC2616], Section&nbsp;2.2</a>&gt;

   In order to include character set and language information, this
   specification modifies the <a href="./rfc2616">RFC 2616</a> grammar to be:

     parameter     = reg-parameter / ext-parameter

     reg-parameter = parmname LWSP "=" LWSP value

     ext-parameter = parmname "*" LWSP "=" LWSP ext-value

     parmname      = 1*attr-char

     ext-value     = charset  "'" [ language ] "'" value-chars
                   ; like <a href="./rfc2231">RFC 2231</a>'s &lt;extended-initial-value&gt;
                   ; (see <a href="./rfc2231#section-7">[RFC2231], Section&nbsp;7</a>)

     charset       = "UTF-8" / "ISO-8859-1" / mime-charset

     mime-charset  = 1*mime-charsetc
     mime-charsetc = ALPHA / DIGIT
                   / "!" / "#" / "$" / "%" / "&amp;"
                   / "+" / "-" / "^" / "_" / "`"
                   / "{" / "}" / "~"
                   ; as &lt;mime-charset&gt; in <a href="./rfc2978#section-2.3">Section&nbsp;2.3 of [RFC2978]</a>
                   ; except that the single quote is not included
                   ; SHOULD be registered in the IANA charset registry

     language      = &lt;Language-Tag, defined in <a href="./rfc5646#section-2.1">[RFC5646], Section&nbsp;2.1</a>&gt;

     value-chars   = *( pct-encoded / attr-char )

     pct-encoded   = "%" HEXDIG HEXDIG
                   ; see <a href="./rfc3986#section-2.1">[RFC3986], Section&nbsp;2.1</a>

     attr-char     = ALPHA / DIGIT
                   / "!" / "#" / "$" / "&amp;" / "+" / "-" / "."
                   / "^" / "_" / "`" / "|" / "~"
                   ; token except ( "*" / "'" / "%" )






<span class="grey">Reschke                      Standards Track                    [Page 4]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-5" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


   Thus, a parameter is either a regular parameter (reg-parameter), as
   previously defined in <a href="./rfc2616#section-3.6">Section&nbsp;3.6 of [RFC2616]</a>, or an extended
   parameter (ext-parameter).

   Extended parameters are those where the left-hand side of the
   assignment ends with an asterisk character.

   The value part of an extended parameter (ext-value) is a token that
   consists of three parts: the REQUIRED character set name (charset),
   the OPTIONAL language information (language), and a character
   sequence representing the actual value (value-chars), separated by
   single quote characters.  Note that both character set names and
   language tags are restricted to the US-ASCII character set, and are
   matched case-insensitively (see <a href="./rfc2978#section-2.3">[RFC2978], Section&nbsp;2.3</a> and <a href="./rfc5646#section-2.1.1">[RFC5646],
   Section&nbsp;2.1.1</a>).

   Inside the value part, characters not contained in attr-char are
   encoded into an octet sequence using the specified character set.
   That octet sequence is then percent-encoded as specified in <a href="./rfc3986#section-2.1">Section</a>
   <a href="./rfc3986#section-2.1">2.1 of [RFC3986]</a>.

   Producers MUST use either the "UTF-8" ([<a href="./rfc3629" title="&quot;UTF-8, a transformation format of ISO 10646&quot;">RFC3629</a>]) or the "ISO-8859-1"
   ([<a href="#ref-ISO-8859-1" title="&quot;Information technology -- 8-bit single-byte coded graphic character sets -- Part 1: Latin alphabet No. 1&quot;">ISO-8859-1</a>]) character set.  Extension character sets (mime-
   charset) are reserved for future use.

      Note: recipients should be prepared to handle encoding errors,
      such as malformed or incomplete percent escape sequences, or non-
      decodable octet sequences, in a robust manner.  This specification
      does not mandate any specific behavior, for instance, the
      following strategies are all acceptable:

      *  ignoring the parameter,

      *  stripping a non-decodable octet sequence,

      *  substituting a non-decodable octet sequence by a replacement
         character, such as the Unicode character U+FFFD (Replacement
         Character).

      Note: the <a href="./rfc2616">RFC 2616</a> token production (<a href="./rfc2616#section-2.2">[RFC2616], Section&nbsp;2.2</a>)
      differs from the production used in <a href="./rfc2231">RFC 2231</a> (imported from
      <a href="./rfc2045#section-5.1">Section&nbsp;5.1 of [RFC2045]</a>) in that curly braces ("{" and "}") are
      excluded.  Thus, these two characters are excluded from the attr-
      char production as well.







<span class="grey">Reschke                      Standards Track                    [Page 5]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-6" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


      Note: the &lt;mime-charset&gt; ABNF defined here differs from the one in
      <a href="./rfc2978#section-2.3">Section&nbsp;2.3 of [RFC2978]</a> in that it does not allow the single
      quote character (see also RFC Errata ID 1912 [<a href="#ref-Err1912" title="RFC 2978">Err1912</a>]).  In
      practice, no character set names using that character have been
      registered at the time of this writing.

<span class="h4"><a class="selflink" id="section-3.2.2" href="#section-3.2.2">3.2.2</a>.  Examples</span>

   Non-extended notation, using "token":

     foo: bar; title=Economy

   Non-extended notation, using "quoted-string":

     foo: bar; title="US-$ rates"

   Extended notation, using the Unicode character U+00A3 (POUND SIGN):

     foo: bar; title*=iso-8859-1'en'%A3%20rates

   Note: the Unicode pound sign character U+00A3 was encoded into the
   single octet A3 using the ISO-8859-1 character encoding, then
   percent-encoded.  Also, note that the space character was encoded as
   %20, as it is not contained in attr-char.

   Extended notation, using the Unicode characters U+00A3 (POUND SIGN)
   and U+20AC (EURO SIGN):

     foo: bar; title*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates

   Note: the Unicode pound sign character U+00A3 was encoded into the
   octet sequence C2 A3 using the UTF-8 character encoding, then
   percent-encoded.  Likewise, the Unicode euro sign character U+20AC
   was encoded into the octet sequence E2 82 AC, then percent-encoded.
   Also note that HEXDIG allows both lowercase and uppercase characters,
   so recipients must understand both, and that the language information
   is optional, while the character set is not.

<span class="h3"><a class="selflink" id="section-3.3" href="#section-3.3">3.3</a>.  Language Specification in Encoded Words</span>

   <a href="./rfc2231#section-5">Section&nbsp;5 of [RFC2231]</a> extends the encoding defined in [<a href="./rfc2047" title="&quot;MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text&quot;">RFC2047</a>] to
   also support language specification in encoded words.  Although the
   HTTP/1.1 specification does refer to <a href="./rfc2047">RFC 2047</a> ([<a href="./rfc2616" title="&quot;Hypertext Transfer Protocol -- HTTP/1.1&quot;">RFC2616</a>], <a href="#section-2.2">Section</a>
   <a href="#section-2.2">2.2</a>), it's not clear to which header field exactly it applies, and
   whether it is implemented in practice (see
   &lt;<a href="http://tools.ietf.org/wg/httpbis/trac/ticket/111">http://tools.ietf.org/wg/httpbis/trac/ticket/111</a>&gt; for details).

   Thus, this specification does not include this feature.



<span class="grey">Reschke                      Standards Track                    [Page 6]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-7" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>.  Guidelines for Usage in HTTP Header Field Definitions</span>

   Specifications of HTTP header fields that use the extensions defined
   in <a href="#section-3.2">Section 3.2</a> ought to clearly state that.  A simple way to achieve
   this is to normatively reference this specification, and to include
   the ext-value production into the ABNF for that header field.

   For instance:

     foo-header  = "foo" LWSP ":" LWSP token ";" LWSP title-param
     title-param = "title" LWSP "=" LWSP value
                 / "title*" LWSP "=" LWSP ext-value
     ext-value   = &lt;see <a href="./rfc5987#section-3.2">RFC 5987, Section&nbsp;3.2</a>&gt;

      Note: The Parameter Value Continuation feature defined in <a href="./rfc2231#section-3">Section</a>
      <a href="./rfc2231#section-3">3 of [RFC2231]</a> makes it impossible to have multiple instances of
      extended parameters with identical parmname components, as the
      processing of continuations would become ambiguous.  Thus,
      specifications using this extension are advised to disallow this
      case for compatibility with <a href="./rfc2231">RFC 2231</a>.

<span class="h3"><a class="selflink" id="section-4.1" href="#section-4.1">4.1</a>.  When to Use the Extension</span>

   <a href="./rfc2277#section-4.2">Section&nbsp;4.2 of [RFC2277]</a> requires that protocol elements containing
   human-readable text are able to carry language information.  Thus,
   the ext-value production ought to be always used when the parameter
   value is of textual nature and its language is known.

   Furthermore, the extension ought to also be used whenever the
   parameter value needs to carry characters not present in the US-ASCII
   ([<a href="#ref-USASCII" title="&quot;Coded Character Set -- 7-bit American Standard Code for Information Interchange&quot;">USASCII</a>]) character set (note that it would be unacceptable to
   define a new parameter that would be restricted to a subset of the
   Unicode character set).

<span class="h3"><a class="selflink" id="section-4.2" href="#section-4.2">4.2</a>.  Error Handling</span>

   Header field specifications need to define whether multiple instances
   of parameters with identical parmname components are allowed, and how
   they should be processed.  This specification suggests that a
   parameter using the extended syntax takes precedence.  This would
   allow producers to use both formats without breaking recipients that
   do not understand the extended syntax yet.

   Example:

     foo: bar; title="EURO exchange rates";
               title*=utf-8''%e2%82%ac%20exchange%20rates




<span class="grey">Reschke                      Standards Track                    [Page 7]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-8" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


   In this case, the sender provides an ASCII version of the title for
   legacy recipients, but also includes an internationalized version for
   recipients understanding this specification -- the latter obviously
   ought to prefer the new syntax over the old one.

      Note: at the time of this writing, many implementations failed to
      ignore the form they do not understand, or prioritize the ASCII
      form although the extended syntax was present.

<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>.  Security Considerations</span>

   The format described in this document makes it possible to transport
   non-ASCII characters, and thus enables character "spoofing"
   scenarios, in which a displayed value appears to be something other
   than it is.

   Furthermore, there are known attack scenarios relating to decoding
   UTF-8.

   See <a href="./rfc3629#section-10">Section&nbsp;10 of [RFC3629]</a> for more information on both topics.

   In addition, the extension specified in this document makes it
   possible to transport multiple language variants for a single
   parameter, and such use might allow spoofing attacks, where different
   language versions of the same parameter are not equivalent.  Whether
   this attack is useful as an attack depends on the parameter
   specified.

<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>.  Acknowledgements</span>

   Thanks to Martin Duerst and Frank Ellermann for help figuring out
   ABNF details, to Graham Klyne and Alexey Melnikov for general review,
   to Chris Newman for pointing out an <a href="./rfc2231">RFC 2231</a> incompatibility, and to
   Benjamin Carlyle and Roar Lauritzsen for implementer's feedback.

<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>.  References</span>

<span class="h3"><a class="selflink" id="section-7.1" href="#section-7.1">7.1</a>.  Normative References</span>

   [<a id="ref-ISO-8859-1">ISO-8859-1</a>]  International Organization for Standardization,
                 "Information technology -- 8-bit single-byte coded
                 graphic character sets -- Part 1: Latin alphabet No.
                 1", ISO/IEC 8859-1:1998, 1998.

   [<a id="ref-RFC2119">RFC2119</a>]     Bradner, S., "Key words for use in RFCs to Indicate
                 Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.





<span class="grey">Reschke                      Standards Track                    [Page 8]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-9" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


   [<a id="ref-RFC2616">RFC2616</a>]     Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
                 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
                 Transfer Protocol -- HTTP/1.1", <a href="./rfc2616">RFC 2616</a>, June 1999.

   [<a id="ref-RFC2978">RFC2978</a>]     Freed, N. and J. Postel, "IANA Charset Registration
                 Procedures", <a href="https://www.rfc-editor.org/bcp/bcp19">BCP 19</a>, <a href="./rfc2978">RFC 2978</a>, October 2000.

   [<a id="ref-RFC3629">RFC3629</a>]     Yergeau, F., "UTF-8, a transformation format of ISO
                 10646", <a href="./rfc3629">RFC 3629</a>, STD 63, November 2003.

   [<a id="ref-RFC3986">RFC3986</a>]     Berners-Lee, T., Fielding, R., and L. Masinter,
                 "Uniform Resource Identifier (URI): Generic Syntax",
                 <a href="./rfc3986">RFC 3986</a>, STD 66, January 2005.

   [<a id="ref-RFC5234">RFC5234</a>]     Crocker, D., Ed. and P. Overell, "Augmented BNF for
                 Syntax Specifications: ABNF", STD 68, <a href="./rfc5234">RFC 5234</a>,
                 January 2008.

   [<a id="ref-RFC5646">RFC5646</a>]     Phillips, A., Ed. and M. Davis, Ed., "Tags for
                 Identifying Languages", <a href="https://www.rfc-editor.org/bcp/bcp47">BCP 47</a>, <a href="./rfc5646">RFC 5646</a>,
                 September 2009.

   [<a id="ref-USASCII">USASCII</a>]     American National Standards Institute, "Coded Character
                 Set -- 7-bit American Standard Code for Information
                 Interchange", ANSI X3.4, 1986.

<span class="h3"><a class="selflink" id="section-7.2" href="#section-7.2">7.2</a>.  Informative References</span>

   [<a id="ref-Err1912">Err1912</a>]     RFC Errata, Errata ID 1912, <a href="./rfc2978">RFC 2978</a>,
                 &lt;<a href="http://www.rfc-editor.org">http://www.rfc-editor.org</a>&gt;.

   [<a id="ref-RFC2045">RFC2045</a>]     Freed, N. and N. Borenstein, "Multipurpose Internet
                 Mail Extensions (MIME) Part One: Format of Internet
                 Message Bodies", <a href="./rfc2045">RFC 2045</a>, November 1996.

   [<a id="ref-RFC2047">RFC2047</a>]     Moore, K., "MIME (Multipurpose Internet Mail
                 Extensions) Part Three: Message Header Extensions for
                 Non-ASCII Text", <a href="./rfc2047">RFC 2047</a>, November 1996.

   [<a id="ref-RFC2231">RFC2231</a>]     Freed, N. and K. Moore, "MIME Parameter Value and
                 Encoded Word Extensions: Character Sets, Languages, and
                 Continuations", <a href="./rfc2231">RFC 2231</a>, November 1997.

   [<a id="ref-RFC2277">RFC2277</a>]     Alvestrand, H., "IETF Policy on Character Sets and
                 Languages", <a href="https://www.rfc-editor.org/bcp/bcp18">BCP 18</a>, <a href="./rfc2277">RFC 2277</a>, January 1998.

   [<a id="ref-RFC2388">RFC2388</a>]     Masinter, L., "Returning Values from Forms: multipart/
                 form-data", <a href="./rfc2388">RFC 2388</a>, August 1998.



<span class="grey">Reschke                      Standards Track                    [Page 9]</span></pre>
<hr class='noprint'/><!--NewPage--><pre class='newpage'><span id="page-10" ></span>
<span class="grey"><a href="./rfc5987">RFC 5987</a>            Charset/Language Encoding in HTTP        August 2010</span>


Author's Address

   Julian F. Reschke
   greenbytes GmbH
   Hafenweg 16
   Muenster, NW  48155
   Germany

   EMail: julian.reschke@greenbytes.de
   URI:   <a href="http://greenbytes.de/tech/webdav/">http://greenbytes.de/tech/webdav/</a>









































Reschke                      Standards Track                   [Page 10]
</pre>

</body>
</html>

